
aux_source_directory(. TEST_SRC)

find_package(GTest REQUIRED)
if (${GTest_FOUND})
    include(GoogleTest)
    add_library(gtest_compile_flags INTERFACE)
    target_compile_features(gtest_compile_flags INTERFACE cxx_std_17)
endif ()

foreach (FILE_PATH ${TEST_SRC})
    string(REGEX REPLACE ".+/(.+)\\..*" "\\1" FILE_NAME ${FILE_PATH})
    if (${FILE_NAME} MATCHES "^gtest_")
        add_executable(${FILE_NAME} ${FILE_PATH})
        target_link_libraries(
                ${FILE_NAME}
                PRIVATE ezstl
                PRIVATE gtest_compile_flags
                PRIVATE GTest::gtest_main
        )
    endif ()
endforeach ()